package com.yu.task.controller;

import com.yu.task.globalResult.R;
import com.yu.task.utils.UploadUtils;
import kotlin.contracts.Returns;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/upload")
public class UploadController {
    @PostMapping("/img")
    public R uploadImage(@RequestParam MultipartFile img){
        String imagePath = UploadUtils.upload(img);
        return R.success(imagePath);
    }
}
